package operation;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements Operation {
    public void work(BookList list) {
        System.out.println("查找图书...");
        System.out.println("请输入你要查找的书名：");
        Scanner sc = new Scanner(System.in);
        String findBooklName = sc.nextLine();
        int currentsize = list.getSizeUsed();
        for (int i = 0; i < currentsize; i++) {
            if (findBooklName.equals(list.getBook(i).getBookName())) {
                System.out.println("找到了!!!");
                System.out.println(list.getBook(i));
                return;
            }
        }
        System.out.println("没有找到这本书！！！");
        return;
    }
}
